package com.cyy.user.textbluetoothble.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.cyy.user.textbluetoothble.R;

import java.util.List;

/**
 * Created by USER on 2016-11-11.
 */
public class DataAdapter extends BaseAdapter{
    private Context context ;
    private List<String> mList ;
    public DataAdapter(Context context,List<String> list){
        this.context = context;
        this.mList = list;
    }
    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        ViewHolder viewHolder;
        if(view==null){
            view = LayoutInflater.from(context).inflate(R.layout.item_notify,viewGroup,false);
            viewHolder = new ViewHolder();
            viewHolder.text_data_notify = (TextView) view.findViewById(R.id.text_data_notify);
            view.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) view.getTag();
        }
        viewHolder.text_data_notify.setText(mList.get(i).toString());
        return view;
    }
    class ViewHolder{
        TextView text_data_notify;
    }
}
